<?php
	//
	//This php will handle the 
	// UserFetch.java 
	// - fetchUserById function
	//
	
	//Connect to database
	include '../../dbc.php';
	
	//$id = $_POST['id'];
	
	//Select non-admin and non-blocked restaurant
    $query01 = "SELECT * FROM meal WHERE is_blocked='0' AND is_published='1' ORDER BY id DESC";
	$query01_result = mysql_query($query01);
	if(mysql_num_rows($query01_result) > 0){
		$i = 0;
		while($query01_result_row = mysql_fetch_array($query01_result)){
			$id[$i] 		= $query01_result_row['id'];
			$restaurant[$i] = $query01_result_row['restaurant'];
			$name[$i] 		= $query01_result_row['name'];
			$description[$i]= $query01_result_row['description'];
			$tag[$i] 		= $query01_result_row['tag'];
			$picture[$i] 	= $query01_result_row['picture'];
			$price[$i] 		= $query01_result_row['price'];
			$i++;
		}
		
		
		$response["STATUS"] = "1";
		$response["NUMBER"] = $i;
		$response["ID"] = $id;
		$response["RESTAURANT"] = $restaurant;
		$response["NAME"] = $name;
		$response["DESCRIPTION"] = $description;
		$response["TAG"] = $tag;
		$response["PICTURE"] = $picture;
		$response["PRICE"] = $price;
		
		echo json_encode($response);
	}else{
		//Unable to get user
		$response["STATUS"] = "0";
		$response["NUMBER"] = "0";
		echo json_encode($response);
	}
	

?>